Skip to content

query: RecentCreates snapshot COW and head RCU - #261

Merged
reardencode merged 2 commits into
masterfrom
query/recent-creates-cow
Aug 26, 2026
Merged

query: RecentCreates snapshot COW and head RCU#261
reardencode merged 2 commits into
masterfrom
query/recent-creates-cow

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

What

RecentCreates::snapshot no longer clones the pending HashMap on every stamp. Pending is a COW Arc<LiveMap>: snapshot Arc-clones; note* / filter_pending make_mut; empty pending reuses one process Arc.

Head publish/drop is RCU. publish_layer / drop_ready / drop_from / expire_through CAS-splice via layer_chain::{cas_head,rcu_head} and retry on a lost CAS. A stale load_full then store cannot restore drop_from heights.

Why

Stamp snapshots were copying the pending map (pins included) every wave (algo-review P17). Head update was load-then-store, safe only if the write thread was the sole mutator — unenforced, and drop_from is on the reorg path (Q-M2).

Algo-review

Closes P17 and Q-M2 by deleting those rows in the same commits as the fixes.

Independent of confirm/wire-plan-batch.

Tests

  • two snapshot() calls with no note* / publish_layer / drop_* share pending by Arc::ptr_eq
  • snapshot before note_pins does not see the note; after does; create_pin Arc-clones the pin
  • empty pending after publish/drop reuses the construction empty Arc
  • cas_head against a stale drop_from head fails; retry prepends onto the current head; dropped height stays gone

rbitcoin-grok added 2 commits August 25, 2026 18:23
snapshot cloned the pending HashMap on every stamp. Hold pending as
Arc<LiveMap>: snapshot Arc-clones; note/filter make_mut; empty maps
reuse one process Arc. Closes algo-review P17.
publish_layer/drop_ready/drop_from/expire_through stored a chain built
from a stale load_full. CAS the ArcSwap head and retry; a lost
drop_from vs publish cannot restore dropped heights. Closes algo-review
Q-M2.
@reardencode
reardencode merged commit 1455bc7 into master Aug 26, 2026
13 checks passed
@rearden-grok
rearden-grok Bot deleted the query/recent-creates-cow branch August 26, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant